package com.gf.user.dao;

import java.util.Date;
import java.util.List;

import com.gf.base.dao.BaseDao;
import com.gf.base.type.Activity;
import com.gf.base.type.LicenseState;
import com.gf.base.type.Role;
import com.gf.base.type.SafeFactor;
import com.gf.user.model.User;

public interface UserBaseDao extends BaseDao {

	/**
	 * 插入数据
	 * 
	 * @param nickname
	 * @param email
	 * @param password
	 * @param idNumber
	 * @param realName
	 * @param sex
	 * @param role
	 * @param ip
	 * @return
	 */
	public long insert(String uuid, String nickname, String email,
			String password, String idNumber, String realName, String idPath,
			String licensePath, String sex, String role, String ip,
			String major, SafeFactor safeFactor);

	/**
	 * 查询身份证号
	 * 
	 * @param idNumber
	 * @param password
	 * @return
	 */
	public User queryByIdNumber(String idNumber, String password);

	/**
	 * 查询邮箱
	 * 
	 * @param email
	 * @param password
	 * @return
	 */
	public User queryByEmail(String email, String password);

	/**
	 * 查询邮箱是否存在<br>
	 * 邮箱唯一
	 * 
	 * @param email
	 * @return
	 */
	public User queryEmailExist(String email);

	/**
	 * 查询匹配的邮箱和身份证号是否存在 ;
	 * 
	 * @return
	 */
	public User queryEmailIdNumberExist(String email, String idNumber);

	/**
	 * 修改密码
	 * 
	 * @param id
	 * @param newPasswd
	 */
	public void updatePasswd(long id, String newPasswd);

	/**
	 * 更改用户的Activity
	 * 
	 * @param id
	 * @param activity
	 */
	public boolean updateActivity(long id, Activity activity);

	/**
	 * 从数据库中删除用户
	 * 
	 * @param id
	 */
	public void deleteUser(long id);

	/**
	 * 通过Id得到用户
	 * 
	 * @param id
	 * @return
	 */
	public User queryUserById(long id);

	/**
	 * 得到最新注册的用户
	 * 
	 * @return
	 */
	public User queryLatestUser();

	/**
	 * 返回>date 用于lucene
	 * 
	 * @return
	 */
	public List<User> queryUserByCreatetime(Date date);

	/**
	 * 得到所有的用户数据<br>
	 * 供lucene同步索引用的
	 * 
	 * @param currentPage
	 * @return
	 */
	public List<User> queryAllBaseUsers(int currentPage, int pageSize, Role role);

	public List<User> queryAllUsers(int currentPage, int pageSize);

	/**
	 * 得到所有的用户数
	 * 
	 * @return
	 */
	public int queryAllBaseUserNumber(Role role);

	public int queryAllUserNumber();

	/**
	 * 通过昵称查询
	 * 
	 * @param nickname
	 * @return
	 */
	public User queryUserByNickname(String nickname);

	/**
	 * 更新关注总数
	 * 
	 * @param userId
	 * @param careCount
	 * @return
	 */
	public boolean updateCareCount(long userId, int careCount);

	/**
	 * 更新粉丝总数
	 * 
	 * @param userId
	 * @param careCount
	 * @return
	 */
	public boolean updateFansCount(long userId, int funCount);

	/**
	 * 
	 * @param id
	 * @param licenseState
	 * @return
	 */
	public boolean updateLicenseState(long id, LicenseState licenseState);

	/**
	 * 得到"关于我们"的最新内容
	 * 
	 * @return
	 */
	public String queryAboutContent();
	
}
